<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>节点克隆</title>
  <style>
    .child {
      width: 100px;
      height: 50px;
      border: 1px solid red;
    }
  </style>
  <script>
    window.onload = function () {
      var parent = document.getElementsByClassName('parent')[0];
      var one = parent.children[0];
      // 浅复制
      // var cloneOne = one.cloneNode()
      // 深复制
      var cloneOne = one.cloneNode(true)
      parent.appendChild(cloneOne)
    }
  </script>
</head>

<body>
  <div class="parent">
    <div class="child">one</div>
    <div class="child">two</div>
    <div class="child">three</div>
  </div>
</body>

</html>